//
//  RMMMemberCardView.m
//  Romomo
//
//  Created by puman on 16/10/17.
//  Copyright © 2016年 mazegong. All rights reserved.
//

#import "RMMMemberCardView.h"

@implementation RMMMemberCardView
- (instancetype)initWithFrame:(CGRect)frame{
    if (self = [super initWithFrame:frame]) {
        self.backgroundColor = kCColor;
        UIView *backView = [[UIView alloc] initWithFrame:CGRectMake(15, 16, kScreenWideth - 30, 180)];
        backView.layer.cornerRadius = 5;
        backView.layer.masksToBounds = YES;
        backView.backgroundColor = COLORFROMCODE(0x403A2C, 1);
        [self addSubview:backView];
        
        UILabel *titleLabel = [[UILabel alloc] initWithFrame:CGRectMake(15, 12, 120, 12)];
        titleLabel.text = @"RONGMOMO VIP CARD";
        titleLabel.textColor = COLORFROMCODE(0xC8B68C, 1);
        titleLabel.font = kFont(10);
        [backView addSubview:titleLabel];
        
        UIImageView *imageV = [[UIImageView alloc] initWithFrame:CGRectMake(titleLabel.left, titleLabel.bottom + 3, kRow, 15)];
        imageV.image = [UIImage imageNamed:@"logocard@3x"];
        [backView addSubview:imageV];
        
        UILabel *vipLabel = [[UILabel alloc] initWithFrame:CGRectMake(imageV.right +7,imageV.top, 80, 15)];
        vipLabel.text = @"VIP 会员卡";
        vipLabel.textColor = COLORFROMCODE(0xC8B68C, 1);
        vipLabel.font = kFont(14);
        [backView addSubview:vipLabel];
        NSMutableAttributedString *attributedString = [[NSMutableAttributedString alloc] initWithString:vipLabel.text];
        [attributedString addAttribute:NSFontAttributeName value:kFont(16) range:NSMakeRange(0, 3)];
        [vipLabel setAttributedText:attributedString];

        
        _balanceLabel = [[UILabel alloc] initWithFrame:CGRectMake(titleLabel.right, kRow, backView.width - titleLabel.right - 15, 30)];
        _balanceLabel.text = @"¥0.00";
        _balanceLabel.textAlignment = NSTextAlignmentRight;
        _balanceLabel.textColor = COLORFROMCODE(0xC8B68C, 1);
        _balanceLabel.font = kFont(24);
        [backView addSubview:_balanceLabel];

        _button = [UIButton buttonWithType:(UIButtonTypeCustom)];
        _button.frame = CGRectMake(15, backView.height - 39, kHalf, 24);
        [_button setTitle:@"充值" forState:(UIControlStateNormal)];
        [_button setTitleColor:COLORFROMCODE(0xC8B68C, 1) forState:(UIControlStateNormal)];
        _button.titleLabel.font = kFont(13);
        _button.layer.borderWidth = 1;
        _button.layer.cornerRadius = 12;
        _button.layer.borderColor = COLORFROMCODE(0xC8B68C, 1).CGColor;
        [backView addSubview:_button];
        
        _labelT = [[UILabel alloc] initWithFrame:CGRectMake(0, backView.bottom + 16, self.width, kMaric)];
        _labelT.textAlignment = NSTextAlignmentCenter;
        _labelT.text = @"暂无数据";
        _labelT.font = kFont(13);
        _labelT.textColor = COLORFROMCODE(0xAEAEAE, 1);
        [self addSubview:_labelT];

    }
    return self;
}
/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/

@end
